package com.apiit.webserviceclient.activities;

import org.w3c.dom.Text;

import com.apiit.webserviceclient.R;
import com.apiit.webserviceclient.R.layout;
import com.apiit.webserviceclient.R.menu;

import android.os.Bundle;
import android.provider.ContactsContract.QuickContact;
import android.app.Activity;
import android.content.Intent;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.QuickContactBadge;
import android.widget.TextView;

public class MyProfile extends Activity implements OnClickListener {
	
	TextView profname;
	TextView country;
	TextView city;
	TextView courseprof;
	TextView firstAccess;
	TextView lastAccess;
	//QuickContactBadge profPic;
	Button back;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_my_profile);
		
		profname = (TextView) findViewById(R.id.txtlmsProfName);
		country = (TextView) findViewById(R.id.txtLmsCountry);
		city = (TextView) findViewById(R.id.txtLmsCity);
		courseprof = (TextView) findViewById(R.id.txtLmsCourseProf);
		firstAccess = (TextView) findViewById(R.id.txtLmsFirstAccess);
		lastAccess = (TextView) findViewById(R.id.txtLmsLastAccess);
		back = (Button) findViewById(R.id.btnlmsprofBack);
		back.setOnClickListener(this);
		
		Intent intename = getIntent();
		String namevalue = intename.getStringExtra("name");
		String countryvalue = intename.getStringExtra("country");
		String cityvalue = intename.getStringExtra("city");
		String course1value = intename.getStringExtra("course1");
		String course2value = intename.getStringExtra("course2");
		String firstAccessvalue = intename.getStringExtra("firstAccess").replaceAll("&nbsp;", "");
		String lastAccessvalue = intename.getStringExtra("lastAccess").replaceAll("&nbsp;", "");
		
		profname.setText(namevalue);
		country.setText(countryvalue);
		city.setText(cityvalue);
		courseprof.setText(course1value +","+course2value );
		//lastAccess.setText(course2value);
		firstAccess.setText(firstAccessvalue);
		lastAccess.setText(lastAccessvalue);
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.my_profile, menu);
		return true;
		

		
		
		
	}

	@Override
	public void onClick(View v) {
		// TODO Auto-generated method stub
		if(v==back){
			Intent i = new Intent(this, LMS.class);
			startActivity(i);
		}
	}

}
